package Decorator;

public class RedShapeDecorator extends ShapeDecorator{
    // 继承自 ShapeDecorator 对象， 因此也有了 shapeDecorator 对象，通过构造函数给当前子类对象赋值

    /*
    创建扩展了 ShapeDecorator 类的实体装饰类
     */

    public RedShapeDecorator(Shape decoratorShape){
        super(decoratorShape);  // 调用了父类的构造函数了 返回一个shape对象
    }

    @Override
    public void draw() {

        decoratedShape.draw();  // 跟踪进入这个 decoratedShape ， 发现是父类继承过来的

        setRedBorder( decoratedShape ); // 通过 RedShapeDecorator 装饰了类
    }

    private void setRedBorder(Shape decoratedShape) {
        System.out.println(" Border color : Red ( to some extent ,its means that extension )");
    }
}
